import copy


# 过滤空值  过滤二级还有部分问题
def filter_empty_values(data):
    data = copy.deepcopy(data)
    if isinstance(data, dict):
        # 如果是字典，递归过滤空值
        return {
            key: filter_empty_values(value)
            for key, value in data.items()
            if value or isinstance(value, bool) or value == 0
        }
    elif isinstance(data, list):
        # 如果是列表，递归过滤空值
        return [
            filter_empty_values(item)
            for item in data
            if item or isinstance(item, bool) or item == 0
        ]
    else:
        # 如果是其他类型，直接返回值
        return data


# 普通循环过滤掉二维数组中的空子数组
def filter_empty_sublist(dataList):
    filtered_minorCycleTable = []
    for sublist in dataList:
        if any(item not in ["", None] for item in sublist):
            filtered_minorCycleTable.append(sublist)
    return
